package com.sz.contro;

import com.sz.entity.AdminUser;
import com.sz.service.AdminUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@Controller
@RequestMapping("/auc")
public class AdminUserContro {

    @Resource
    private AdminUserService adminUserService;

    @RequestMapping(value = "index")
    public String findindex(){
        return "success";
    }

    /**
     * 后台管理员登录
     * @param adminUser
     * @return
     */
    @RequestMapping(value = "admin_login" ,method = RequestMethod.POST)
    public String findAdminUserByNamePwd(AdminUser adminUser){
        AdminUser admin = adminUserService.getAdminByNamePwd(adminUser);
        if(admin == null){
            return "login_backstage";
        }
        //判断登录的管理等级
        /*if(admin.getRoleid() == 0){
            return "";
        }else if(admin.getRoleid() == 1){
            return "";
        }else if(admin.getRoleid() ==2){
            return "";
        }else if(admin.getRoleid() == 3){
            return "";
        }*/

        return "redirect:index";
    }
    @GetMapping(value = "admin_login")
    public String findAdminUserByNamePwd(){
            return "login_backstage";
    }
}
